package com.example.kotlin.scrollingtable.java_type1;

import android.support.annotation.Nullable;
import android.widget.LinearLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.kotlin.scrollingtable.R;
import com.example.kotlin.scrollingtable.type1.model.Type1PriceModel;

/**
 * Created by admin  2019/11/21/18:13
 * Describe
 * 作者 洪亮 admin
 */
public class JavaRvType1RightAdapter extends BaseQuickAdapter<Type1PriceModel, BaseViewHolder> {

    JavaRvType1RightAdapter() {
        super(R.layout.item_layout_type1, null);
    }

    @Nullable
    private JavaRvType1LeftAdapter rvRvMainLeftAdapter;

    @Nullable
    public  JavaRvType1LeftAdapter getRvRvMainLeftAdapter() {
        return this.rvRvMainLeftAdapter;
    }

    public  void setRvRvMainLeftAdapter(JavaRvType1LeftAdapter adapter) {
        this.rvRvMainLeftAdapter = adapter;
    }

    @Override
    protected void convert(BaseViewHolder helper, Type1PriceModel item) {
        int position = helper.getPosition();
        if (position == 1) {
            helper.setText(R.id.tv_data, "假数据");
        } else {
            helper.setText(R.id.tv_data, item.getPriceName());
        }
        LinearLayout view = helper.getView(R.id.layout);
        if (helper.getPosition() % 2 == 1) {
            view.setBackgroundColor(mContext.getResources().getColor(R.color.white));
        } else {
            view.setBackgroundColor(mContext.getResources().getColor(R.color.ff_8));
        }
    }
}
